/*
 * @(#)MaintWorkflowRecordForm.java
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */
package com.dcivision.workflow.web;

import java.util.HashMap;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;

import com.dcivision.framework.ApplicationException;
import com.dcivision.framework.GlobalConstant;
import com.dcivision.framework.TextUtility;
import com.dcivision.framework.Utility;
import com.dcivision.framework.bean.AbstractBaseObject;
import com.dcivision.framework.web.AbstractActionForm;
import com.dcivision.workflow.bean.WorkflowRecord;

/**
  MaintWorkflowRecordForm.java

  This class is the for web form purpose.

  @author      Angus Shiu
  @company     DCIVision Limited
  @creation date   30/07/2003
  @version     $Revision: 1.22 $
*/

public class MaintWorkflowRecordForm extends AbstractActionForm implements com.dcivision.framework.web.WorkflowActionFormInterface {

  public static final String REVISION = "$Revision: 1.22 $";

  private String workflowCode = null;
  private String workflowVersion = null;
  private String workflowGroupID = null;
  private String status = GlobalConstant.RECORD_PENDING;
  private String startDate = null;
  private String endDate = null;
  private String description = null;
  private String workflowCategoryID = null;
  private String documentReferenceNo = null;
  private String documentID = null;
  private String locationPath = null;
  private Integer rootID = null;
  private Integer parentID = null;
  private String formDocID = null;
  private String relatedObjectType = null;
  private String relatedObjectID = null;

  private String copyAllSteps = GlobalConstant.TRUE;

  private String comment = null;

  private String[] categoryObjectID = null;
  private String[] rule = null;
  
  /** Workflow Routine Fields */
  private String submitSystemWorkflow = null;
  private String sysWorkflowCategoryID = null;
  private String workflowRecordID = null;
  private String workflowComment = null;
  private String fileNames = null;
  private String dmsFileNames = null;
  private String displayFileNames = null;
  private String displayDmsFileNames = null;
  private String trackID = null;
  
  private String nextStepDueDates = null;
  private String nextStepAllowAssignDueDate = null;
  private int nextStepDueDateCount = 0;

  private AbstractBaseObject workflowObject = null;
  private HashMap objParamMap = new HashMap();
  
  private String allowInterrupt = "N";
  private String interruptWorkflowRecordID = null;
  private String interruptSubmitter = null;
  private List nextStepAllowAssignStr = null;
  private boolean interruptAble = false;
  
  private String dueDate1 = null;
  private String dueDate2 = null;
  private String dueDate3 = null;
  private String dueDate4 = null;
  private String dueDate5 = null;
  private String dueDate6 = null;
  private String dueDate7 = null;
  private String dueDate8 = null;
  private String dueDate9 = null;
  private String dueDate10 = null;

 
  public MaintWorkflowRecordForm() {
    super();
  }

  public String getWorkflowCode() {
    return(this.workflowCode);
  }

  public void setWorkflowCode(String workflowCode) {
    this.workflowCode = workflowCode;
  }

  public String getWorkflowVersion() {
    return(this.workflowVersion);
  }

  public void setWorkflowVersion(String workflowVersion) {
    this.workflowVersion = workflowVersion;
  }

  public String getWorkflowGroupID() {
    return(this.workflowGroupID);
  }

  public void setWorkflowGroupID(String workflowGroupID) {
    this.workflowGroupID = workflowGroupID;
  }

  public String getStatus() {
    return(this.status);
  }

  public void setStatus(String status) {
    this.status = status;
  }

  public String getStartDate() {
    return(this.startDate);
  }

  public void setStartDate(String startDate) {
    this.startDate = startDate;
  }

  public String getEndDate() {
    return(this.endDate);
  }

  public void setEndDate(String endDate) {
    this.endDate = endDate;
  }

  public String getDescription() {
    return(this.description);
  }

  public void setDescription(String description) {
    this.description = description;
  }

  public String getWorkflowCategoryID() {
    return(this.workflowCategoryID);
  }

  public void setWorkflowCategoryID(String workflowCategoryID) {
    this.workflowCategoryID = workflowCategoryID;
  }

  public String getComment(){
    return(this.comment);
  }

  public void setComment(String comment) {
    this.comment = comment;
  }

  public String getCopyAllSteps() {
    return(this.copyAllSteps);
  }

  public void setCopyAllSteps(String copyAllSteps) {
    this.copyAllSteps = copyAllSteps;
  }

  public void setCategoryObjectID(String[] categoryObjectID) {
    this.categoryObjectID = categoryObjectID;
  }

  public String[] getCategoryObjectID() {
    return this.categoryObjectID ;
  }

  public void setRule(String[] rule) {
    this.rule = rule;
  }

  public String[] getRule() {
    return this.rule;
  }

  public AbstractBaseObject getWorkflowObject() {
    return this.workflowObject;
  }

  public void setWorkflowObject(AbstractBaseObject workflowObject) {
    this.workflowObject = workflowObject;
  }

  public HashMap getObjParamMap() {
    return this.objParamMap;
  }

  public void setObjParamMap(HashMap objParamMap) {
    this.objParamMap = objParamMap;
  }

  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    return super.validate(mapping, request);
  }

  public void reset(ActionMapping mapping, HttpServletRequest request) {
    super.reset(mapping, request);
    this.setID(null);
    this.setWorkflowCode(null);
    this.setWorkflowVersion(null);
    this.setWorkflowGroupID(null);
    this.setStatus(GlobalConstant.RECORD_PENDING);
    this.setStartDate(null);
    this.setEndDate(null);
    this.setDescription(null);
    this.setWorkflowCategoryID(null);
//    this.setDocumentReferenceNo(null);
    this.setDocumentID(null);
    this.setRecordStatus(null);
    this.setUpdateCount(null);
    this.setCreatorID(null);
    this.setCreateDate(null);
    this.setUpdaterID(null);
    this.setUpdateDate(null);

    this.setComment(null);
    this.setLocationPath(null);
    this.setRootID(null);
    this.setParentID(null);
    this.setCopyAllSteps(GlobalConstant.TRUE);
    this.setNextStepAllowAssignDueDate(null);
    this.setNextStepDueDateCount(0);
    
  }

  public AbstractBaseObject getFormData() throws ApplicationException {
    WorkflowRecord tmpWorkflowRecord = new WorkflowRecord();
    tmpWorkflowRecord.setID(TextUtility.parseIntegerObj(this.getID()));
    tmpWorkflowRecord.setWorkflowCode(this.getWorkflowCode());
    tmpWorkflowRecord.setWorkflowVersion(this.getWorkflowVersion());
    tmpWorkflowRecord.setWorkflowGroupID(TextUtility.parseIntegerObj(this.getWorkflowGroupID()));
    tmpWorkflowRecord.setStatus(this.getStatus());
    tmpWorkflowRecord.setStartDate(parseTimestamp(this.getStartDate()));
    tmpWorkflowRecord.setEndDate(parseTimestamp(this.getEndDate()));
    tmpWorkflowRecord.setDescription(this.getDescription());
    tmpWorkflowRecord.setWorkflowCategoryID(TextUtility.parseIntegerObj(this.getWorkflowCategoryID()));
    tmpWorkflowRecord.setNextStepDynamicAssignDueDate(this.getNextStepAllowAssignDueDate());
    tmpWorkflowRecord.setNextStepDynamicAssignDueDateCount(this.getNextStepDueDateCount());
    tmpWorkflowRecord.setRecordStatus(this.getRecordStatus());
    tmpWorkflowRecord.setUpdateCount(TextUtility.parseIntegerObj(this.getUpdateCount()));
    tmpWorkflowRecord.setCreatorID(TextUtility.parseIntegerObj(this.getCreatorID()));
    tmpWorkflowRecord.setCreateDate(parseTimestamp(this.getCreateDate()));
    tmpWorkflowRecord.setUpdaterID(TextUtility.parseIntegerObj(this.getUpdaterID()));
    tmpWorkflowRecord.setUpdateDate(parseTimestamp(this.getUpdateDate()));
    tmpWorkflowRecord.setAllowInterrupt(this.getAllowInterrupt());
    tmpWorkflowRecord.setInterruptSubmitter(this.getInterruptSubmitter());
    tmpWorkflowRecord.setNextStepAllowAssignStr(this.nextStepAllowAssignStr);
    if (!Utility.isEmpty(this.getInterruptWorkflowRecordID())) {
      tmpWorkflowRecord.setInterruptWorkflowRecordID(new Integer(this.getInterruptWorkflowRecordID()));
    }
    tmpWorkflowRecord.setLocationPath(this.getLocationPath());
    tmpWorkflowRecord.setRootID(this.getRootID());
    tmpWorkflowRecord.setParentID(this.getParentID());
    return tmpWorkflowRecord;
  }

  public void setFormData(AbstractBaseObject baseObj) throws ApplicationException {
    WorkflowRecord tmpWorkflowRecord = (WorkflowRecord)baseObj;
    this.setID(TextUtility.formatIntegerObj(tmpWorkflowRecord.getID()));
    this.setWorkflowCode(tmpWorkflowRecord.getWorkflowCode());
    this.setWorkflowVersion(tmpWorkflowRecord.getWorkflowVersion());
    this.setWorkflowGroupID(TextUtility.formatIntegerObj(tmpWorkflowRecord.getWorkflowGroupID()));
    this.setStatus(tmpWorkflowRecord.getStatus());
    this.setStartDate(formatTimestamp(tmpWorkflowRecord.getStartDate()));
    this.setEndDate(formatTimestamp(tmpWorkflowRecord.getEndDate()));
    this.setDescription(tmpWorkflowRecord.getDescription());
    this.setWorkflowCategoryID(TextUtility.formatIntegerObj(tmpWorkflowRecord.getWorkflowCategoryID()));
    this.setNextStepAllowAssignDueDate(tmpWorkflowRecord.getNextStepDynamicAssignDueDate());
    this.setNextStepDueDateCount(tmpWorkflowRecord.getNextStepDynamicAssignDueDateCount());
    this.setRecordStatus(tmpWorkflowRecord.getRecordStatus());
    this.setUpdateCount(TextUtility.formatIntegerObj(tmpWorkflowRecord.getUpdateCount()));
    this.setCreatorID(TextUtility.formatIntegerObj(tmpWorkflowRecord.getCreatorID()));
    this.setCreateDate(formatTimestamp(tmpWorkflowRecord.getCreateDate()));
    this.setUpdaterID(TextUtility.formatIntegerObj(tmpWorkflowRecord.getUpdaterID()));
    this.setUpdateDate(formatTimestamp(tmpWorkflowRecord.getUpdateDate()));
    this.setAllowInterrupt(tmpWorkflowRecord.getAllowInterrupt());
    this.setInterruptSubmitter(tmpWorkflowRecord.getInterruptSubmitter());
    this.setNextStepAllowAssignStr(tmpWorkflowRecord.getNextStepAllowAssignStr());
    if(!Utility.isEmpty(tmpWorkflowRecord.getInterruptWorkflowRecordID())) {
      this.setInterruptWorkflowRecordID(tmpWorkflowRecord.getInterruptWorkflowRecordID().toString());
    }
    this.setLocationPath(tmpWorkflowRecord.getLocationPath());
    this.setRootID(tmpWorkflowRecord.getRootID());
    this.setParentID(tmpWorkflowRecord.getParentID());
  }

  public String getFileNames() {
    return this.fileNames;
  }

  public void setFileNames(String fileNames) {
    this.fileNames = fileNames;
  }
  
  public String getDmsFileNames() {
    return this.dmsFileNames;
  }

  public void setDmsFileNames(String dmsFileNames) {
    this.dmsFileNames = dmsFileNames;
  }
  
  public String getDisplayFileNames(){
  	return this.displayFileNames;
  }
  
  public void setDisplayFileNames(String displayFileNames){
  	this.displayFileNames = displayFileNames;
  }
  
  public String getDisplayDmsFileNames(){
  	return this.displayDmsFileNames;
  }
  
  public void setDisplayDmsFileNames(String displayDmsFileNames){
  	this.displayDmsFileNames = displayDmsFileNames;
  }
  
  public String getSubmitSystemWorkflow() {
    return(this.submitSystemWorkflow);
  }

  public void setSubmitSystemWorkflow(String submitSystemWorkflow) {
    this.submitSystemWorkflow = submitSystemWorkflow;
  }

  public String getSysWorkflowCategoryID() {
    return(this.sysWorkflowCategoryID);
  }

  public void setSysWorkflowCategoryID(String sysWorkflowCategoryID) {
    this.sysWorkflowCategoryID = sysWorkflowCategoryID;
  }

  public String getWorkflowRecordID() {
    return(this.workflowRecordID);
  }

  public void setWorkflowRecordID(String workflowRecordID) {
    this.workflowRecordID = workflowRecordID;
  }

  public String getWorkflowComment() {
    return(this.workflowComment);
  }

  public void setWorkflowComment(String workflowComment) {
    this.workflowComment = workflowComment;
  }
  
  public String getNextStepDueDates(){
    return this.nextStepDueDates;  
  }
  
  public void setNextStepDueDates(String nextStepDueDates) {
    this.nextStepDueDates = nextStepDueDates; 
  }
  
  public String getNextStepAllowAssignDueDate(){
    return this.nextStepAllowAssignDueDate;
  }
  
  public void setNextStepAllowAssignDueDate(String nextStepAllowAssignDueDate){
    this.nextStepAllowAssignDueDate = nextStepAllowAssignDueDate;
  }
  
  public int getNextStepDueDateCount(){
    return this.nextStepDueDateCount;
  }
  
  public void setNextStepDueDateCount(int nextStepDueDateCount){
    this.nextStepDueDateCount = nextStepDueDateCount;  
  }
  
  public String getDocumentReferenceNo(){
    return this.documentReferenceNo;
  }
  
  public void setDocumentReferenceNo(String documentReferenceNo){
    this.documentReferenceNo = documentReferenceNo;  
  }
  
  public String getDocumentID(){
    return this.documentID;  
  }
  
  public void setDocumentID(String documentID){
    this.documentID = documentID;  
  }
  
  public String getAllowInterrupt() {
    return allowInterrupt;
  }
    
  public void setAllowInterrupt(String allowInterrupt) {
    this.allowInterrupt = allowInterrupt;
  }
    
  public String getInterruptWorkflowRecordID() {
    return interruptWorkflowRecordID;
  }
    
  public void setInterruptWorkflowRecordID(String interruptWorkflowRecordID) {
    this.interruptWorkflowRecordID = interruptWorkflowRecordID;
  }
  
  
  public String getInterruptSubmitter() {
    return interruptSubmitter;
  }
  
  public void setInterruptSubmitter(String interruptSubmitter) {
    this.interruptSubmitter = interruptSubmitter;
  }  
  
  public String getLocationPath() {
  	return locationPath;
  }
  
  public void setLocationPath(String locationPath) {
  	this.locationPath = locationPath;
  }
  
  public Integer getRootID() {
  	return rootID;
  }
  
  public void setRootID(Integer rootID) {
  	this.rootID = rootID;
  }
  
  public Integer getParentID() {
  	return parentID;
  }
  
  public void setParentID(Integer parentID) {
  	this.parentID = parentID;
  }
   
  public boolean isInterruptAble() {
    return interruptAble;
  }
  
  public void setInterruptAble(boolean interruptAble) {
    this.interruptAble = interruptAble;
  }
  
 
  public List getNextStepAllowAssignStr() {
    return nextStepAllowAssignStr;
  }
  
  public void setNextStepAllowAssignStr(List nextStepAllowAssignStr) {
    this.nextStepAllowAssignStr = nextStepAllowAssignStr;
  }
  
  public String getDueDate1() {
    return dueDate1;
  }
  
  public void setDueDate1(String dueDate1) {
    this.dueDate1 = dueDate1;
  }
  
  public String getDueDate10() {
    return dueDate10;
  }
  
  public void setDueDate10(String dueDate10) {
    this.dueDate10 = dueDate10;
  }
  
  public String getDueDate2() {
    return dueDate2;
  }
  
  public void setDueDate2(String dueDate2) {
    this.dueDate2 = dueDate2;
  }
  
  public String getDueDate3() {
    return dueDate3;
  }
  
  public void setDueDate3(String dueDate3) {
    this.dueDate3 = dueDate3;
  }
  
  public String getDueDate4() {
    return dueDate4;
  }
  
  public void setDueDate4(String dueDate4) {
    this.dueDate4 = dueDate4;
  }
  
  public String getDueDate5() {
    return dueDate5;
  }
  
  public void setDueDate5(String dueDate5) {
    this.dueDate5 = dueDate5;
  }
  
  public String getDueDate6() {
    return dueDate6;
  }
  
  public void setDueDate6(String dueDate6) {
    this.dueDate6 = dueDate6;
  }
  
  public String getDueDate7() {
    return dueDate7;
  }
  
  public void setDueDate7(String dueDate7) {
    this.dueDate7 = dueDate7;
  }
  
  public String getDueDate8() {
    return dueDate8;
  }
  
  public void setDueDate8(String dueDate8) {
    this.dueDate8 = dueDate8;
  }
  
  public String getDueDate9() {
    return dueDate9;
  }
  
  public void setDueDate9(String dueDate9) {
    this.dueDate9 = dueDate9;
  }  
  
  public String getTrackID() {
  	return trackID;
  }
  
  public void setTrackID(String trackID) {
  	this.trackID = trackID;
  }
  
  public String getFormDocID() {
  	return formDocID;
  }

  public void setFormDocID(String formDocID) {
  	this.formDocID = formDocID;
  }
      
  public String getRelatedObjectID() {
  	return relatedObjectID;
  }
  
  public void setRelatedObjectID(String relatedObjectID) {
  	this.relatedObjectID = relatedObjectID;
  }
  
  public String getRelatedObjectType() {
  	return relatedObjectType;
  }
  
  public void setRelatedObjectType(String relatedObjectType) {
  	this.relatedObjectType = relatedObjectType;
  }
}
